package com.mk.admin.controller;

import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.SurveyVo;
import com.mk.admin.service.SurveyService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a/adm/survey")
@Api(tags = "调查问卷")
public class SurveyController {
    @Autowired
    private SurveyService surveyService;

    @PostMapping("/select")
    public ResultDto select(@RequestBody SurveyVo surveyVo) {
        return surveyService.select(surveyVo);
    }

    @PostMapping("/add")
    public ResultDto add(@RequestBody SurveyVo surveyVo) {
        return surveyService.add(surveyVo);
    }

    @PostMapping("/update")
    public ResultDto update(@RequestBody SurveyVo surveyVo) {
        return surveyService.update(surveyVo);
    }

    @PostMapping("/delete")
    public ResultDto delete(@RequestBody SurveyVo surveyVo) {
        return surveyService.delete(surveyVo.getId());
    }

    @PostMapping("/status")
    public ResultDto status(@RequestBody SurveyVo surveyVo) {
        return surveyService.status(surveyVo.getId());
    }
}
